package ua.epam.elective;

import human.User;

import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Properties;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Level;
import org.apache.log4j.Logger;

import web.ServletElective;
import xml.ConnectionPoolHolder;

import jdbc.UserDao;

public class Main {
	private static final Logger log = Logger.getLogger(Main.class);
	
	
	public static void main(String[] args) {

		log.debug("Start processing\n");
		 
		Long l = null;
		String s = "-300";
	       
		class Test implements Runnable {
			public User user;

			@Override
			public void run() {

				UserDao userDao2 = new UserDao();
				try {
					userDao2.start();
					User[] users = new User[10];
					int i;
					for (i = 0; i < 10; i++) {
						users[i] = userDao2.selectUserById(1L);
					}
					userDao2.close();
					
					user = users[0];
					System.out.println(user.toString());
					
					log.debug("Result: " + user);
				} catch (SQLException e) {
					e.printStackTrace();
				}
			}

		}
		User user = null;
		Test tests[] = new Test[10];
		int i = 0;
		for (Test t : tests) {

			t = new Test();
			Thread thread = new Thread(t);
			thread.start();
			if (i == 0) {
				i = 1;
				user = t.user;
			}
		}

		 
	log.info("uuuups-----------------------------------------");	 

	}
}
